import nltk
from nltk.corpus import webtext  # 加载库
from collections import Counter
from nltk.book import *
from nltk.corpus import PlaintextCorpusReader
import re
import jieba
import jieba.posseg as psg  # 加载jieba库中的分词函数

text = '中国武术太极拳成功列入人类非物质文化遗产代表作名录'
seg_list = jieba.cut(text, cut_all=True)
print('全模式：', '/ ' .join(seg_list))
seg_list = jieba.cut(text, cut_all=False)
print('精确模式：', '/ '.join(seg_list))
seg_list = jieba.cut_for_search(text)
print('搜索引擎模式', '/ '.join(seg_list))

sent = '去森林公园爬山。'
for w, t in psg.cut(sent):
      print(w, '/', t)